const { merge } = require('webpack-merge');
const webpack = require('webpack');

const baseConfig = require('./base.config');
const { resolveApp } = require('../utils');

module.exports = merge(baseConfig, {
  entry: [
    resolveApp('src/app/main'),
    // Runtime code for hot module replacement
    'webpack/hot/dev-server.js',
    // Dev server client for web socket transport, hot and live reload logic
    'webpack-dev-server/client/index.js?hot=true&live-reload=true',
  ],
  devtool: 'cheap-source-map',
  plugins: [new webpack.HotModuleReplacementPlugin()],
  devServer: {
    static: {
      directory: resolveApp('/'),
    },
  },
});
